package com.zrrd.gmall.webAll.controller;

import com.alibaba.fastjson.JSONObject;
import com.zrrd.gmall.common.result.Result;
import com.zrrd.gmall.product.fegin.ProductFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private ProductFeignClient productFeignClient;

    @GetMapping({"/","index.html"})
    public String index(HttpServletRequest request){
        //获取分类层级
        Result result = productFeignClient.getBaseCategoryList();
        request.setAttribute("list",result.getData());

        return "index/index";
    }
}
